<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>订单管理</title>
    <link href="css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="js/jquery.js"></script>


</head>


<body>
<form id="form1" runat="server" onsubmit="return false;">
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">订单管理</a></li>
            <li><a href="#">订单管理</a></li>
        </ul>
    </div>

    <div class="rightinfo">

        <div class="seachform">
            <li><label>订单号</label>
                <input type="text" class="scinput" id="txtOrderId" th:value="${orderId}"/></li>

            <li><label>下单用户</label>
                <input type="text" class="scinput" id="txtPhone" th:value="${phone}"/></li>

            <li><label>创建时间</label>
                <input type="text" id="txtBegin" placeholder="起始时间" class="scinput"
                       onClick="WdatePicker()" th:value="${beginTime}"/>
            </li>
            <li >
                <input type="text" id="txtEnd" placeholder="截止时间" class="scinput"
                       onClick="WdatePicker()" th:value="${endTime}"/>
            </li>

            <li><label>状态</label>
                <select id="drpStatus" class="scinput">
                    <option value="" th:selected="(${status} =='')">全部</option>
                    <option value="1" th:selected="(${status} =='1')">已支付</option>
                    <option value="0" th:selected="(${status} =='0')">未支付</option>
                </select>
            </li>


            <li><label>&nbsp;</label><input id="btnSearch" type="button" class="scbtn" value="查询"/></li>

            <div class="tools">
                <ul class="toolbar">
                    <li id="btnRefuse"><span><img src="images/t03.png"/></span>删除订单</li>
                </ul>
            </div>
        </div>


        <table class="tablelist">
            <thead>
            <tr>
                <th width="50px"><input type="checkbox" id="chkSelectAll"/></th>
                <th width="50px">序号</th>
                <th width="120px">订单号</th>
                <th width="120px">下单用户</th>
                <th width="200px">下单时间</th>
                <th width="100px">总金额</th>
                <th width="200px">交易编号</th>
                <th width="80px">状态</th>
                <th>&nbsp;</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="order,iterStat : ${pageInfo.list}">
                <td><input type="checkbox" name="chkSelect" th:value="${order.id}"/></td>
                <td th:text="${iterStat.count}"></td>
                <td th:text="${order.order_id}"></td>
                <td th:text="${order.user_phone}"></td>
                <td th:text="${#dates.format(order.create_time,'yyyy-MM-dd HH:mm:ss')}"></td>
                <td th:text="${order.money}"></td>
                <td th:text="${order.transaction_number}"></td>
                <td th:text="${order.status}=='1'?'已支付':'未支付'"></td>

                <td>&nbsp;</td>
            </tr>
            </tbody>
        </table>
        <div class='pagin' th:include="pagefoot::frag (${pageInfo},@{?1=1(orderId=${orderId},status=${status})})">
        </div>

    </div>

    <script type="text/javascript">
        $('.tablelist tbody tr:odd').addClass('odd');
    </script>

</form>


<link href="plugin/artDialog/artDialog/skins/blue.css" rel="stylesheet"/>
<script src="plugin/artDialog/artDialog/artDialog.min.js" type="text/javascript"></script>
<script src="plugin/artDialog/artDialog/artDialog.plugins.min.js" type="text/javascript"></script>
<script src="plugin/artDialog/dialog.js" type="text/javascript"></script>.
<script type="text/javascript" src="../../admin/plugin/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    /*<![CDATA[*/

    function getSelectedIds() {
        var items = $('input[name="chkSelect"]');
        var ids = new Array();
        for (var i = 0; i < items.length; i++) {
            if ($(items[i]).attr('checked')) {
                ids.push($(items[i]).val());
            }
        }
        return ids + '';
    }

    function refuse() {
        ids = getSelectedIds();
        if ("" == ids) {
            showNotice("请先选择");
            return;
        }
        art.dialog(
            {
                content: '确认删除订单？',
                lock: true
            },
            function () {
                $.ajax({
                    url: 'deleteOrder',
                    type: 'POST',
                    data: {
                        'ids': ids
                    },
                    dataType: 'json',
                    success: function (data) {
                        if (data.status == '0') {
                            showNotice('删除成功');
                            location.reload();
                        } else {
                            showNotice(data.msg);
                        }
                    }
                });
            },
            function () {
            }
        );
    }



    function search() {
        var orderId = $('#txtOrderId').val();
        var phone = $('#txtPhone').val();
        var beginTime =$('#txtBegin').val();
        var endTime =$('#txtEnd').val();
        var status = $('#drpStatus').val();
        location.href = '?orderId=' + orderId + '&phone=' + phone + '&beginTime=' + beginTime+ '&endTime=' + endTime+ '&status=' + status;
    }

    $(function () {
        $('#chkSelectAll').click(function () {
            $('input[name="chkSelect"]').attr('checked', $('#chkSelectAll').attr('checked'));
        });

        $('#btnRefuse').click(function () {
            refuse();
        });

        $('#btnSearch').click(function () {
            search();
        });
    });
    /*]]>*/
</script>

</body>
</html>